<?php
session_start();
function redirect($page) {
    header('Location: ' . $page);
    exit;
}

if (isset($_SESSION['username'])) {
    
    include ("kalkulasiSuara.php");
    ?> 

    <html>

        <head>
            <title>Tabulasi E-Vote</title>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <script type="text/javascript" src="js/jquery-2.1.1.js"></script>
            <script type="text/javascript" src="js/bootstrap.min.js"></script>
            <script type="text/javascript" src="js/jchart.js"></script>
            <script type="text/javascript" src="js/highcharts.js"></script>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <link rel="stylesheet" href="css/bootstrap.css" type="text/css">
            <link rel="stylesheet" href="css/bootstrap-responsive.css" type="text/css">
            <link rel="stylesheet" href="css/bootstrap-responsive.min.css" type="text/css">
            <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
            <link rel="stylesheet" href="css/style.css" type="text/css">

            <style>

                body{
                    margin-left: 0;
                    background-image: url("img/footer_lodyas.png");
                    background-repeat: repeat-x;
                    color : white;
                }
                .nav-tabs a{
                    color:silver;
                    //background-color : black;
                }
                .box-info{
                    //background-color: silver;
                    font-size: 20px;
                    padding : 30px;
                    margin : auto;
                }

                #number{
                    vertical-align: middle;
                    font-size: 150px;
                }

                #number2{
                    font-size: 50px;
                }

                .bloksema{
                    margin: auto;
                    min-height: 400px;
                    width: 500px;
                    padding :30px ;
                    border-style: solid;
                }
                
                .blokrincian{
                    margin: auto;
                    width: 800px;
                    padding :30px ;
                    border-style: solid;
                }

                .bloksema:hover{
                    //background-color: white;
                    background-color: rgba(127,127,127, 0.3);
                }

                .center{
                    vertical-align: middle;
                    margin : auto;
                    text-align: center;
                }
            </style>
        </head>

        <body>
            <ul class="nav nav-tabs">
                <li class="active"><a data-toggle="tab" href="#content-summary">Summary</a></li>
                <li><a data-toggle="tab" href="#content-sema">SEMA</a></li>
                <li><a data-toggle="tab" href="#content-tingkat1">Tingkat 1</a></li>
                <li><a data-toggle="tab" href="#content-tingkat2">Tingkat 2</a></li>
                <li><a data-toggle="tab" href="#content-tingkat3">Tingkat 3</a></li>
                <li><a data-toggle="tab" href="#content-tingkat4">Tingkat 4</a></li>
                <li class="dropdown pull-right">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Admin<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="logout_admin.php">Logout</a></li>
                    </ul>
                </li>
            </ul>

            <div class="tab-content">
                <div id="content-summary" class="tab-pane fade in active">
                    <br>
                    <div class="box-info center">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="bloksema">
                                    <p>Total Suara Masuk :<br><span id="number"><?php echo jumlahSuara() ?></span> suara</p>


                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="bloksema">
                                    <?php
                                    for ($i = 1; $i <= 4; $i++) {
                                        echo "<p>tingkat " . $i . " : <span id='number2'>" . jumlahSuaraAngkatan($i) . "</span> suara</p>";
                                    }
                                    ?>
                                </div>
                            </div>
                        </div>
                        

                    </div>
                </div>
                <div id="content-sema" class="tab-pane fade active">
                    <br>
                    <!--<p>hasil vote sema</p>-->
                    <div id="container-sema" style="min-width: 310px; height: 400px; max-width: 800px; margin: 0 auto"></div>
                    <div class="box-info center">
                        <div class="blokrincian">
                            <div class="row">
                                <div class="col-md-6">
                                    <p><?php echo namaCalon(1)."<br>". jumlahMilihSema(1)?></p>
                                </div>
                                <div class="col-md-6">
                                    <p><?php echo namaCalon(2)."<br>". jumlahMilihSema(2)?></p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="content-tingkat1" class="tab-pane fade active">
                    <!--<p>hasil vote tingkat 1</p>-->
                    <br>
                    <div id="container-tingkat1" style="min-width: 310px; height: 400px; max-width: 800px; margin: 0 auto"></div>
                    <div class="box-info center">
                        <div class="blokrincian">
                            <div class="row">
                                <div class="col-md-4">
                                    <p><?php echo namaCalon(3)."<br>". jumlahMilihAngkatan(3)?></p>
                                </div>
                                <div class="col-md-4">
                                    <p><?php echo namaCalon(4)."<br>". jumlahMilihAngkatan(4)?></p>
                                </div>
                                <div class="col-md-4">
                                    <p><?php echo namaCalon(5)."<br>". jumlahMilihAngkatan(5)?></p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="content-tingkat2" class="tab-pane fade active">
                    <!--<p>hasil vote tingkat 2</p>-->
                    <br>
                    <div id="container-tingkat2" style="min-width: 310px; height: 400px; max-width: 800px; margin: 0 auto"></div>
                    <div class="box-info center">
                        <div class="blokrincian">
                            <div class="row">
                                <div class="col-md-6">
                                    <p><?php echo namaCalon(6)."<br>". jumlahMilihAngkatan(6)?></p>
                                </div>
                                <div class="col-md-6">
                                    <p><?php echo namaCalon(7)."<br>". jumlahMilihAngkatan(7)?></p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="content-tingkat3" class="tab-pane fade active">
                    <!--<p>hasil vote tingkat 3</p>-->
                    <br>
                    <div id="container-tingkat3" style="min-width: 310px; height: 400px; max-width: 800px; margin: 0 auto"></div>
                    <div class="box-info center">
                        <div class="blokrincian">
                            <div class="row">
                                <div class="col-md-6">
                                    <p><?php echo namaCalon(8)."<br>". jumlahMilihAngkatan(8)?></p>
                                </div>
                                <div class="col-md-6">
                                    <p><?php echo namaCalon(9)."<br>". jumlahMilihAngkatan(9)?></p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="content-tingkat4" class="tab-pane fade active">
                    <!--<p>hasil vote tingkat 4</p>-->
                    <br>
                    <div id="container-tingkat4" style="min-width: 310px; height: 400px; max-width: 800px; margin: 0 auto"></div>
                    <div class="box-info center">
                        <div class="blokrincian">
                            <div class="row">
                                <div class="col-md-6">
                                    <p><?php echo namaCalon(10)."<br>". jumlahMilihAngkatan(10)?></p>
                                </div>
                                <div class="col-md-6">
                                    <p><?php echo namaCalon(11)."<br>". jumlahMilihAngkatan(11)?></p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>


            <script type="text/javascript" src="js/piechart.js"></script>

            <footer id="foter">
                <b>&COPY;STISAlfa 2015</b>
            </footer>
        </body>

    </html>
    <?php
} else {
    redirect("index_admin.php");
}
?>


